
<script src="components/com_info_leader/public/uploadlib/jquery.min.js" type="text/javascript"></script>
<script src="components/com_info_leader/public/uploadlib/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="components/com_frmessage/public/uploadlib/uploadify.css"/>

<script type="text/javascript" src="../media/system/js/jQuery.vietvang.validate.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#adminForm').validate({
			});
		});
</script>
<form action="index.php?option=com_info_leader" method="post" name="adminForm" id="adminForm" class="adminform" enctype="multipart/form-data">
        <table style="width: 100%;" border=0>
            <tr>
            <td colspan="5">
            <fieldset  id="adminformfieldset" style="width: 90%;">
            
        <table style="width: 100%;" border=0>
            <tr style="vertical-align:top">
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:15%;line-height:30px">指導員コード<span class="err">※</span></td>
                <td>
                    <?php 
                        /* hung check quyen user level 4 */
                        $aut = new bgAuthorize();
                        $group = $aut->getUserGroup();
                        if($group == 11){
                    ?>
                    <label style="line-height:20px"><?php echo $this->row->COCH_CD; ?></label>
                    <input vvName="number" class="hidden" data_required="true" type="text" class="inputbox medium" id="jformCOCH_CD" name="jform[COCH_CD]" value="<?php echo $this->row->COCH_CD; ?>"/><span name="msg_error" ></span>
                    <?php
                        }else{
                    ?>
                    <input vvName="number" data_required="true" type="text" class="inputbox medium" id="jformCOCH_CD" name="jform[COCH_CD]" value="<?php echo $this->row->COCH_CD; ?>"/><span name="msg_error" ></span>
                    <?php
                        }
                    ?>
                </td>
                <?php if($this->row->COCH_CODE != null){ ?>
                    <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:20%;line-height:30px">指導者システムコード</td>
                    <td style="text-align: left;width:20%;">
                        <?php if($group == 11){ ?>
                        <label style="line-height:20px"><?php echo $this->row->COCH_CODE; ?></label>
                        <input type="text" class="hidden" readonly="true" class="inputbox medium" id="jformCOCH_CODE" name="jform[COCH_CODE]" value="<?php echo $this->row->COCH_CODE; ?>" />
                        <?php }else{ ?>
                        <input type="text" readonly="true" class="inputbox medium" id="jformCOCH_CODE" name="jform[COCH_CODE]" value="<?php echo $this->row->COCH_CODE; ?>" />
                        <?php } ?>
                    </td>
                <?php } ?>
      
            </tr>
            <tr style="vertical-align:top" >
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width: 15%;line-height:30px">指導員氏名<span class="err">※</span></td>
                <td style="width:15%;">
                    <?php if($group == 11){ ?>
                    <label style="line-height:20px"><?php echo $this->row->COCH_NAME; ?></label>
                    <input type="text" class="hidden" data_required="true" vvName="fullname" class="inputbox medium" id="jformCOCH_NAME" name="jform[COCH_NAME]" value="<?php echo $this->row->COCH_NAME; ?>"/><span name="msg_error" ></span>
                    <?php }else{ ?>
                    <input type="text" data_required="true" vvName="fullname" class="inputbox medium" id="jformCOCH_NAME" name="jform[COCH_NAME]" value="<?php echo $this->row->COCH_NAME; ?>"/><span name="msg_error" ></span>
                    <?php } ?>
                </td>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:20%;line-height:30px">カナ</td>
                <td style="text-align: left;width:20%;">
                    <?php if($group == 11){ ?>
                    <label style="line-height:20px"><?php echo $this->row->COCH_KANA; ?></label>
                    <input type="text" class="hidden" id="jformCOCH_KANA" name="jform[COCH_KANA]" value="<?php echo $this->row->COCH_KANA; ?>"/>
                    <?php }else{ ?>
                    <input type="text" class="inputbox medium" id="jformCOCH_KANA" name="jform[COCH_KANA]" value="<?php echo $this->row->COCH_KANA; ?>"/>
                    <?php } ?>
                </td>
                <td style="width: 20%;"></td>
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">所属センターコード<span class="err">※</span></td>
                <td style="width:20%;">
                    <?php if($group == 11){ ?>
                    <label style="line-height:20px"><?php echo $this->row->COCH_OCBA_CODE; ?></label>
                    <input type="text" class="hidden" readonly=""  id="jformOCBA_TOWN_CODE" name="jform[COCH_OCBA_CODE]" class="inputbox medium" value="<?php echo $this->row->COCH_OCBA_CODE; ?>" />
                    <?php }else{ ?>
                    <input type="text" readonly=""  id="jformOCBA_TOWN_CODE" name="jform[COCH_OCBA_CODE]" class="inputbox medium" value="<?php echo $this->row->COCH_OCBA_CODE; ?>" />
                    <a href="#" id="link_ocba_town_code" style="line-height: 30px;" class="line-height28;">検索</a>
                    <?php } ?>
                </td>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">職業</td>
                <td >
                    <select class="medium" id="jformCOCH_JOBM_CODE" name="jform[COCH_JOBM_CODE]">
                        <?php
                            foreach($this->listjob as $value){
                          ?>
                          <option value="<?php echo $value->JOBM_CODE;?>"<?php if($this->row->COCH_JOBM_CODE == $value->JOBM_CODE){ echo 'selected="selected"'; } ?>>
                          <?php echo $value->JOBM_NAME; ?></option>
                          <?php
                            }
                          ?>
                    </select>
                </td>
                <td>
                    </td>
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">性別</td>
                <td>
                    <select class="medium" id="jformCOCH_SEX" name="jform[COCH_SEX]">
                        <option value="1" <?php if($this->row->COCH_SEX == 1){ echo 'selected="selected"'; } ?>>男性</option>
                        <option value="2" <?php if($this->row->COCH_SEX == 2){ echo 'selected="selected"'; } ?>>女性</option>
                    </select>
                </td>
                <td class="td_small" >生年月日</td>
                <td >
                    <?php if($this->row->COCH_BDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BDATE));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BDATE]', 'jformCOCH_BDATE');?>
                    <span name="msg_error"></span>
                </td>
                
            </tr>
            <tr style="vertical-align:top">
                <td class="td_small">登録年月日</td>
                <td >
                    <?php if($group == 11){ ?>
                    <label style="line-height:20px"><?php if($this->row->COCH_RDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_RDATE));}else{ $dt=null;} echo $dt; ?></label>
                    <?php }else{ ?>
                    <?php if($this->row->COCH_RDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_RDATE));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_RDATE]', 'jformCOCH_RDATE');?>
                     <span name="msg_error"></span>
                     <?php } ?>
                </td>
                <td></td>
                
                
            </tr>
             <tr style="vertical-align:top">
                <td class="td_small">更新年月日</td>
                <td>
                    <?php if($group == 11){ ?>
                    <label style="line-height:20px"><?php if($this->row->COCH_MDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_MDATE));}else{ $dt=null;} echo $dt; ?></label>
                    <?php }else{ ?>
                    <?php if($this->row->COCH_MDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_MDATE));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_MDATE]', 'jformCOCH_MDATE');?>
                    <span name="msg_error"></span>
                    <?php } ?>
                </td>
                
            </tr>
             <tr style="vertical-align:top">
                <td class="td_small">有効期限年月日</td>
                <td>
                    <?php if($group == 11){ ?>
                    <label style="line-height:20px"><?php if($this->row->COCH_LDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_LDATE));}else{ $dt=null;} echo $dt; ?></label>
                    <?php }else{ ?>
                    <?php if($this->row->COCH_LDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_LDATE));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_LDATE]', 'jformCOCH_LDATE');?>
                    <span name="msg_error"></span> 
                    <?php } ?>
                </td>
                <td></td>
                <td><label class="err">※印は入力必須項目です。</label></td>
                
            </tr>
            <?php if($group != 11){ ?>
             <tr style="vertical-align:top">
                <td class="td_small">抹消年月日</td>
                <td>
                    <?php if($this->row->COCH_EDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_EDATE));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_EDATE]', 'jformCOCH_EDATE');?>
                     <span name="msg_error"></span>
                </td>
            </tr>
             <tr style="vertical-align:top">
                <td class="td_small">抹消処理年月日</td>
                <td>
                    <?php if($this->row->COCH_DDATE != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_DDATE));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_DDATE]', 'jformCOCH_DDATE');?>
                     <span name="msg_error"></span>
                </td>
            </tr>
            <?php } ?>
            </table>
    </fieldset>
            </td></tr>
            
            <tr>
            <td colspan="5">
            <fieldset  id="adminformfieldset" style="width: 90%;">
        <legend>自宅</legend>
        <table style="width: 100%;" border=0>
            
             <tr style="vertical-align:top">
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:16%;vertical-align: top;line-height: 30px;">郵便番号</td>
                <td style="width:200px;">
                    <input type="text" vvName="postcode" class="inputbox medium" id="jformCOCH_POST" name="jform[COCH_POST]" value="<?php echo $this->row->COCH_POST ?>"/>
                    <span name="msg_error"></span>
                </td>
                
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:20%;line-height:30px">都道府県</td>
                <td style="text-align: left;width:220px;">
                    <select class="medium" id="jformCOCH_PRE1" name="jform[COCH_PRE1]">
                            <option value='0'>選択してください</option>
                        <?php
                            foreach($this->listpref as $value){
                          ?>
                          <option value="<?php echo $value->PREF_CODE;?>"<?php if($this->row->COCH_PRE1 == $value->PREF_CODE){ echo 'selected="selected"'; } ?>>
                          <?php echo $value->PREF_NAME; ?></option>
                          <?php
                            }
                          ?>
                    </select>
                </td>
                <td style="text-align: left;width:20%;"></td>
            </tr>
             <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">住所</td>
                <td colspan="4"><input type="text" class="inputbox sizexx" id="jformCOCH_ADD1" name="jform[COCH_ADD1]" value="<?php echo $this->row->COCH_ADD1 ?>"/></td>               
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">マンション・ビル名</td>
                <td colspan="4"><input type="text" class="inputbox sizexx" id="jformCOCH_BUI1" name="jform[COCH_BUI1]" value="<?php echo $this->row->COCH_BUI1 ?>"/></td>
                
            </tr>
            <tr style="vertical-align:top">
                <td class="td_small">自宅電話番号</td>
                <td>
                    <input type="text" vvName="phone" class="inputbox medium" id="jformCOCH_TEL" name="jform[COCH_TEL]" value="<?php echo $this->row->COCH_TEL ?>"/>
                    <span name="msg_error"></span>
                </td>
                
                <td class="td_small">自宅FAX</td>
                <td>
                    <input type="text" vvName="fax" class="inputbox medium" id="jformCOCH_FAX" name="jform[COCH_FAX]" value="<?php echo $this->row->COCH_FAX?>"/>
                    <span name="msg_error"></span>
                </td>
            </tr>
            <tr style="vertical-align:top">
                <td class="td_small">自宅メールアドレス</td>
                <td>
                    <input type="text" vvName="email" class="inputbox medium" id="jformCOCH_MAIL" name="jform[COCH_MAIL]" value="<?php echo $this->row->COCH_MAIL ?>"/>
                    <span name="msg_error"></span>
                </td>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;line-height:30px;">自宅メールアドレス メルマガ登録 :</td>
                <td class="text-align-left" style="line-height:20px;" ><label id="mailf"><?php if(($this->row->COCH_MAIF==1) && ($this->row->COCH_MAIL!=null)) {echo '登録済み';} else echo '登録なし';  ?></label></td>
                <td style="visibility: hidden;">
                      <input type="text" name="COCH_MAIL_OLD" id="COCH_MAIL_OLD" value="<?php echo $this->row->COCH_MAIL ?>" >
                </td>

            </tr>
            <tr style="vertical-align:top">
                <td class="td_small">携帯メールアドレス</td>
                <td>
                    <input type="text" vvName="email" class="inputbox medium" id="jformCOCH_MAIK" name="jform[COCH_MAIK]" value="<?php echo $this->row->COCH_MAIK; ?>"/>
                    <span name="msg_error"></span>
                </td>

                <td style="text-align: right;font-size: 1.091em;padding-right:5px;line-height:30px;">携帯メールアドレス メルマガ登録 :</td>
                <td style="line-height:20px;" class="text-align-left" ><label id="mailf"><?php if(($this->row->COCH_MAKF==1)&& ($this->row->COCH_MAIK!=null)) {echo '登録済み';} else echo '登録なし';  ?></label></td>
                <td style="visibility: hidden;">
                      <input type="text" name="COCH_MAIK_OLD" id="COCH_MAIK_OLD" value="<?php echo $this->row->COCH_MAIK; ?>">
                </td>
                

            </tr>
            
            </table>
    </fieldset>
            </td></tr>
            
            <tr>
            <td colspan="5">
            <fieldset  id="adminformfieldset" style="width: 90%;">
        <legend>勤務先</legend>
        <table style="width: 100%;" border=0>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:15%;" >勤務先名</td>
                <td colspan="4"><input type="text" class="inputbox medium" id="jformCOCH_NAMW" name="jform[COCH_NAMW]" value="<?php echo $this->row->COCH_NAMW ?>"/></td>
              
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:16%;">所属部署</td>
                <td style="width:200px;"><input type="text" class="inputbox medium" id="jformCOCH_UNIT" name="jform[COCH_UNIT]" value="<?php echo $this->row->COCH_UNIT ?>" />
                </td>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:20%;">役職</td>
                <td style="text-align: left;width:220px;"><input type="text" class="inputbox medium" id="jformCOCH_POSI" name="jform[COCH_POSI]" value="<?php echo $this->row->COCH_POSI ?>"/></td>
                <td style="width:20%;"></td>
            </tr>
            <tr style="vertical-align:top">
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;width:15%;vertical-align: top;line-height: 30px;">郵便番号</td>
                <td>
                    <input type="text" vvName="postcode" class="inputbox medium" id="jformCOCH_POSW" name="jform[COCH_POSW]" value="<?php echo $this->row->COCH_POSW ?>"/>
                    <span name="msg_error"></span>
                </td>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;line-height:30px">都道府県</td>
                <td>
                    <select class="medium" id="jformCOCH_PRE2" name="jform[COCH_PRE2]">
                            <option value='0'>選択してください</option>
                        <?php
                            foreach($this->listpref as $value){
                          ?>
                          <option value="<?php echo $value->PREF_CODE;?>" <?php if($this->row->COCH_PRE2 == $value->PREF_CODE){ echo 'selected="selected"'; } ?>>
                          <?php echo $value->PREF_NAME; ?></option>
                          <?php
                            }
                          ?>
                    </select>
                </td>
                <td></td>
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">勤務先住所</td>
                <td colspan="4"><input type="text" class="inputbox sizexx" id="jformCOCH_ADD2" name="jform[COCH_ADD2]" value="<?php echo $this->row->COCH_ADD2 ?>"/></td>
             
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">マンション・ビル名</td>
                <td colspan="4"><input type="text" class="inputbox sizexx" id="jformCOCH_BUI2" name="jform[COCH_BUI2]" value="<?php echo $this->row->COCH_BUI2 ?>"/></td>
             
            </tr>
            <tr style="vertical-align:top">
                <td class="td_small">勤務先電話番号</td>
                <td>
                    <input type="text" vvName="phone" class="inputbox medium" id="jformCOCH_TELW" name="jform[COCH_TELW]" value="<?php echo $this->row->COCH_TELW ?>" />
                    <span name="msg_error"></span>
                </td>
                <td class="td_small">勤務先FAX</td>
                <td>
                    <input type="text" vvName="fax" class="inputbox medium" id="jformCOCH_FAXW" name="jform[COCH_FAXW]" value="<?php echo $this->row->COCH_FAXW ?>"/>
                    <span name="msg_error"></span>
                </td>
                
            </tr>
            <tr style="vertical-align:top">
                <td class="td_small">勤務先メールアドレス</td>
                <td>
                    <input type="text" vvName="email" class="inputbox medium" id="jformCOCH_MAIW" name="jform[COCH_MAIW]" value="<?php echo $this->row->COCH_MAIW ?>"/>
                    <span name="msg_error"></span>
                </td>

                <td style="text-align: right;font-size: 1.091em;padding-right:5px;line-height:30px">勤務先メールアドレス　メルマガ登録 :</td>
                <td style="line-height:20px"><label><?php if($this->row->COCH_MAFW==1 && $this->row->COCH_MAIW!=null) {echo '登録済み';} else echo '登録なし';  ?></label></td>
                <td style="visibility: hidden;">
                      <input type="text" name="COCH_MAIW_OLD" id="COCH_MAIW_OLD" value="<?php echo $this->row->COCH_MAIW ?>">
                </td>

               
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">勤務形態 </td>
                <td colspan="4">
                    <table>
                        <tr>
                            <td><input type="radio" id="jform_showtitle0" name="jform[COCH_WOKF]" value="1" <?php if($this->row->COCH_WOKF == 1){ echo 'checked="checked"'; } ?> /></td>
                            <td><label for="jform_showtitle0">常勤</label></td>
                            <td><input type="radio" id="jform_showtitle1" name="jform[COCH_WOKF]" value="0" <?php if($this->row->COCH_WOKF == 0){ echo 'checked="checked"'; } ?> /></td>
                            <td><label for="jform_showtitle1">非常勤</label> </td>
                        </tr>
                    </table>     
                </td>
            </tr>
            
            <tr style="vertical-align:top" >
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;line-height:30px">写真</td>
                <td colspan="2">
                    <input type="file" runat="server" class="inputbox" id="jformCOCH_IMG" name="jformCOCH_IMG" />
                    <span style="font-size: 1.091em;color:blue;">(推奨される画像の縦横比は「1:1」です。)</span>
                    <input type="hidden" name="jform[COCH_IMG_NEW]" id="value_COCH_IMG" value="<?php echo $this->row->COCH_IMG ?>" />
                    <input type="hidden" name="jform[IMG_OLD]" id="IMG_OLD" value="<?php echo $this->row->COCH_IMG ?>" />
                </td>
                <td id="preview">
                    <img style="width: 40%" id="showimg" src="<?php if($this->row->COCH_IMG != null) echo 'uploads/images/com_info_leader/'.$this->row->COCH_IMG?>"/>
                </td>
                <td><input style="width: 40%" type="hidden" id="jformOCBA_IMG_OLD" name="jformOCBA_IMG_OLD" hidden="true" value="<?php echo $this->row->COCH_IMG ?>"/></td>     
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;vertical-align: top;line-height:30px">人材バンク</td>
                <td colspan="4">
                    <table style="width: 50%;">
                        <tr>
                 <!-- Hien thi cac checkbox nguon nhan luc  -->
                    <?php
                   
                        $i = 0;
                        foreach($this->human as $key=>$value){
                            $i++;
                    ?>
                    <td style="width: 3%;">
                        <input style="float: right;" type="checkbox" name="chh<?php echo $value->HUMAN_CODE; ?>" id="chh<?php echo $value->HUMAN_CODE; ?>" 
                    <?php if(($this->row->COCH_HUMAN_CODE_LIST)!= null){
                            $ar=explode(',',$this->row->COCH_HUMAN_CODE_LIST);
                            foreach ($ar as $vl)
                                {
                                   if($value->HUMAN_CODE == $vl){ echo ' checked = "checked" '; }
                                } 
                        }
                    ?>
                    value="<?php echo $value->HUMAN_NAME; ?>" <?php if(isset($this->list['chh'.$value->HUMAN_CODE])){ echo 'checked="checked"'; } ?>  />
                    </td>
                    <td style="width:  22%;">
                    <label for="chh<?php echo $value->HUMAN_CODE; ?>"><?php echo $value->HUMAN_NAME; ?></label>
                    </td>
                    <?php
                            if($i == 3){
                                $i = 0;
                                echo "</tr><tr>"; 
                            }    
                        }
                    ?>
                   </tr>
                    </table>
              </td>
                
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">指導者会</td>
                <td colspan="4"> 
                    <table style="width: 36%;" border=0>
                        <tr>
                            <td style="width: 1%;"><input type="checkbox" style="float: right;" value="登録" id="jformCOCH_REGI" name="cbCOCH_REGI" <?php if($this->row->COCH_REGI == 1){ echo ' checked = "checked" '; } ?>/></td>
                            <td style="width:  5%;"><label for="jformCOCH_REGI">登録</label></td>
                        
                            <td style="width: 10%;font-size: 1.091em;text-align:right;">指導者会名</td>
                            <td style="width:  20%;"><input type="text" class="inputbox medium" id="jformCOCH_LDME" name="jform[COCH_LDME]" value="<?php echo $this->row->COCH_LDME ?>" /></td>
                        </tr>
                    </table>
                </td>
                
               
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">事業協力</td>
                <td colspan="4">
                    <table style="width: 50%;">
                        <tr>
                 <!-- Hien thi cac checkbox lien ket dao tao  -->
                    <?php
                   
                        $i = 0;
                        foreach($this->lkdt as $key=>$value){
                            $i++;
                    ?>
                    <td style="width: 2%;">
                        <input style="float: right;" type="checkbox" name="chl<?php echo $value->LKDT_CODE; ?>" id="chl<?php echo $value->LKDT_CODE; ?>" 
                    <?php if(($this->row->COCH_LKDT_CODE_LIST)!= null){
                            $ar=explode(',',$this->row->COCH_LKDT_CODE_LIST);
                            foreach ($ar as $vl)
                                {
                                   if($value->LKDT_CODE == $vl){ echo ' checked = "checked" '; }
                                } 
                        }
                    ?>
                    value="<?php echo $value->LKDT_NAME; ?>" <?php if(isset($this->list['chl'.$value->LKDT_CODE])){ echo 'checked="checked"'; } ?>  />
                    </td>
                    <td style="width:  20%;">
                    <label for="chl<?php echo $value->LKDT_CODE; ?>"><?php echo $value->LKDT_NAME; ?></label>
                    </td>
                    <?php
                            if($i==4){
                                $i = 0;
                                echo "</tr><tr>"; 
                            }    
                        }
                    ?>
                   </tr>
                    </table>
              </td>
                
            </tr>
            
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;vertical-align:top;line-height:30px;">B&G事業担当</td>
                <td colspan="4">
                    <table style="width: 565px;" border=0>
                        <tr style="vertical-align:top">
                            <td class="td_small">自</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSS1 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS1));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS1]', 'jformCOCH_BUSS1');?><span name="msg_error"></span></td>
                            <td style="text-align: center;font-size: 1.091em;line-height:30px">~</td>
                            <td class="td_small">至</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSE1 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE1));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE1]', 'jformCOCH_BUSE1');?><span name="msg_error"></span> </td>
                        </tr>
                    </table>
                </td>
                <!-- 
                <td>
                    <label>自</label>
                    <?php if($this->row->COCH_BUSS1 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS1));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS1]', 'jformCOCH_BUSS1');?>
                    <label class="from-to-edit">~</label>
                    <span name="msg_error"></span>
                </td>
                <td colspan="3">
                    <label>至</label>
                    <?php if($this->row->COCH_BUSE1 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE1));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE1]', 'jformCOCH_BUSE1');?>
                    <span name="msg_error"></span>
                </td>
                -->
            </tr>
            <tr>
                <td></td>
                
                <td colspan="4">
                    <table style="width: 565px;" border=0">
                        <tr style="vertical-align:top">
                            <td class="td_small">自</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSS2 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS2));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS2]', 'jformCOCH_BUSS2');?><span name="msg_error"></span></td>
                            <td style="text-align: center;font-size: 1.091em;line-height:30px">~</td>
                            <td class="td_small">至</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSE2 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE2));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE2]', 'jformCOCH_BUSE2');?><span name="msg_error"></span> </td>
                        </tr>
                    </table>
                </td>
                <!-- 
                <td>
                    <label>自</label>
                    <?php if($this->row->COCH_BUSS2 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS2));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS2]', 'jformCOCH_BUSS2');?>
                    <label class="from-to-edit">~</label>
                    <span name="msg_error"></span>
                </td>
                <td colspan="3">
                    <label>至</label>
                    <?php if($this->row->COCH_BUSE2 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE2));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE2]', 'jformCOCH_BUSE2');?>
                    <span name="msg_error"></span>
                </td>
                -->
            </tr>
            <tr>
                <td></td>
                
                <td colspan="4">
                    <table style="width: 565px;" border=0">
                        <tr style="vertical-align:top">
                            <td class="td_small">自</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSS3 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS3));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS3]', 'jformCOCH_BUSS3');?><span name="msg_error"></span></td>
                            <td style="text-align: center;font-size: 1.091em;line-height:30px">~</td>
                            <td class="td_small">至</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSE3 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE3));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE3]', 'jformCOCH_BUSE3');?><span name="msg_error"></span> </td>
                        </tr>
                    </table>
                </td>
                <!-- 
                <td>
                    <label>自</label>
                    <?php if($this->row->COCH_BUSS3 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS3));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS3]', 'jformCOCH_BUSS3');?>
                    <label class="from-to-edit">~</label>
                    <span name="msg_error"></span>
                </td>
                <td colspan="3">
                    <label>至</label>
                    <?php if($this->row->COCH_BUSE3 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE3));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE3]', 'jformCOCH_BUSE3');?>
                    <span name="msg_error"></span>
                </td>
                -->
            </tr>
            <tr>
                <td></td>
                
                <td colspan="4">
                    <table style="width: 565px;" border=0">
                        <tr style="vertical-align:top">
                            <td class="td_small">自</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSS4 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS4));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS4]', 'jformCOCH_BUSS4');?><span name="msg_error"></span></td>
                            <td style="text-align: center;font-size: 1.091em;line-height:30px">~</td>
                            <td class="td_small">至</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSE4 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE4));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE4]', 'jformCOCH_BUSE4');?><span name="msg_error"></span> </td>
                        </tr>
                    </table>
                </td>
                <!-- 
                <td>
                    <label>自</label>
                    <?php if($this->row->COCH_BUSS4 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS4));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS4]', 'jformCOCH_BUSS4');?>
                    <label class="from-to-edit">~</label>
                    <span name="msg_error"></span>
                </td>
                <td colspan="3">
                    <label>至</label>
                    <?php if($this->row->COCH_BUSE4 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE4));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE4]', 'jformCOCH_BUSE4');?>
                    <span name="msg_error"></span>
                </td>
                 -->
            </tr>
            <tr>
                <td></td>
                
                <td colspan="4">
                    <table style="width: 565px;" border=0">
                        <tr style="vertical-align:top">
                            <td class="td_small">自</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSS5 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS5));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS5]', 'jformCOCH_BUSS5');?><span name="msg_error"></span></td>
                            <td style="text-align: center;font-size: 1.091em;line-height:30px">~</td>
                            <td class="td_small">至</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSE5 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE5));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE5]', 'jformCOCH_BUSE5');?><span name="msg_error"></span> </td>
                        </tr>
                    </table>
                </td>
                <!-- 
                <td>
                    <label>自</label>
                    <?php if($this->row->COCH_BUSS5 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS4));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS5]', 'jformCOCH_BUSS5');?>
                    <label class="from-to-edit">~</label>
                    <span name="msg_error"></span>
                </td>
                <td colspan="3">
                    <label>至</label>
                    <?php if($this->row->COCH_BUSE5 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE4));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE5]', 'jformCOCH_BUSE5');?>
                    <span name="msg_error"></span>
                </td>
                 -->
            </tr>
            <tr>
                <td></td>
                
                <td colspan="4">
                    <table style="width: 565px;" border=0">
                        <tr style="vertical-align:top">
                            <td class="td_small">自</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSS6 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS6));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS6]', 'jformCOCH_BUSS6');?><span name="msg_error"></span></td>
                            <td style="text-align: center;font-size: 1.091em;line-height:30px">~</td>
                            <td class="td_small">至</td>
                            <td style="width: 200px;"><?php if($this->row->COCH_BUSE6 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE6));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE6]', 'jformCOCH_BUSE6');?><span name="msg_error"></span> </td>
                        </tr>
                    </table>
                </td>
                <!-- 
                <td>
                    <label>自</label>
                    <?php if($this->row->COCH_BUSS6 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSS6));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSS6]', 'jformCOCH_BUSS6');?>
                    <label class="from-to-edit">~</label>
                    <span name="msg_error"></span>
                </td>
                <td colspan="3">
                    <label>至</label>
                    <?php if($this->row->COCH_BUSE6 != 0){ $dt = date('Y-m-d',strtotime($this->row->COCH_BUSE6));}else{ $dt=null;} echo JHtml::calendar($dt, 'jform[COCH_BUSE6]', 'jformCOCH_BUSE6');?>
                    <span name="msg_error"></span>
                </td>
                 -->
            </tr>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">特記事項</td>
                <td colspan="4"><textarea class="inputbox sizex" id="jformCOCH_COMM" name="jform[COCH_COMM]"><?php echo $this->row->COCH_COMM ?></textarea></td>

                
            </tr>
            <?php if($group != 11){ ?>
            <tr>
                <td style="text-align: right;font-size: 1.091em;padding-right:5px;">備考（財団記入欄）</td>
                <td colspan="4"><textarea class="inputbox sizex" id="jformCOCH_NOTE" name="jform[COCH_NOTE]"><?php echo $this->row->COCH_NOTE ?></textarea></td>

                
            </tr>
            <?php } ?>
            <!--
            <tr>
                <td>■指導員資格リス<br>ト（内部用）</td>
                <td colspan="4"><textarea class="inputbox bigxxx" id="jformCOCH_FLST" name="jform[COCH_FLST]" ><?php echo $this->row->COCH_FLST ?></textarea></td>
                
            </tr>
            <tr>
                <td>■指導員資格リス<br>ト（センター用）</td>
                <td colspan="4"><textarea class="inputbox bigxxx" id="jformCOCH_CLST" name="jform[COCH_CLST]"><?php echo $this->row->COCH_CLST ?></textarea></td>
                <td></td>
            </tr>
            -->
            </table>
    </fieldset>
            </td></tr>
            
        </table>
        <div>
		<input type="hidden" name="task" value="" />
        
        </div>
    
</form>


<?php $timestamp = time();?>
<script>
  
    $(function() {
        $('#jformCOCH_IMG').uploadify({
            'formData'     : {
    			'timestamp' : '<?php echo $timestamp;?>',
    			'token'     : '<?php echo md5('unique_salt' . $timestamp);?>',
                'COCH_CODE' : '<?php echo $this->row->COCH_CODE; ?>'
    		},
            'multi'    : false,
            'removeTimeout' : 1,
            'fileSizeLimit' : '125MB',
            'buttonText' : '画像を選択してください。',
            'width'    : 170,
            'swf'      : 'components/com_info_leader/public/uploadlib/uploadify.swf',
            'uploader' : 'components/com_info_leader/public/uploadlib/uploadify.php',           
            'onUploadSuccess' : function(file, data, response) {
                
                /* show image */
                $('#preview').html(
                '<img style="width: 40%" id="showimg" src="uploads/images/com_info_leader/'+data+'" />');
                $('#value_COCH_IMG').val(data);
            }
            // Put your options here
        });
    });
  
   /* remove anh chon khi click cancel */
    Joomla.submitbutton = function(task){
        if(task == 'cancel'){
                var image_new = jq('#value_COCH_IMG').val();
                var img_old = jq('#IMG_OLD').val();
                
                if(image_new != ''){
                    if(image_new != img_old){
                        jq.ajax({
                          url: 'index.php?option=com_info_leader&task=removeImage'
                            +'&image_name='+image_new,
                          context: document.body
                        }).done(function(data ) {
                            
                        });
                        /* set lai hinh cu cho the file */
                        jq('#value_COCH_IMG').val(img_old);
                    }
                }
        }
        if(task == 'save' || task == 'savetemp'){
                var image_new = jq('#value_COCH_IMG').val();
                var img_old = jq('#IMG_OLD').val();
                
                if(img_old != ''){
                    if(image_new != img_old){
                        jq.ajax({
                          url: 'index.php?option=com_info_leader&task=removeImage'
                            +'&image_name='+img_old,
                          context: document.body
                        }).done(function(data ) {
                            
                        });
                       
                    }
                }
        }
           
        Joomla.submitform(task, document.getElementById('adminForm'));
           
     }
     
     
    jq(document).ready(function() {
        var zb;
        // show a dialog box when clicking on a link
        //show a dialog box: town search
        jq('#link_ocba_town_code').bind('click', function(e) {
            e.preventDefault();
            zb = new jq.Zebra_Dialog('', {
                source:  {'ajax': 'index.php?option=com_info_leader&views=bg&task=popup_town&tmpl=component'},
                height: 800,
                width: 550,
                title:  '市町村検索',
                type:  '',
                buttons:  [
                    {caption: 'キャンセル', callback: function() {}}
                    //{caption: '閉じる', callback: function() { alert('"Yes" was clicked')}},
                        
                ]                                  
                               
            });
        });
        
        
        jq(".link_town_code").live("click",function(){
            var id = jq(this).html();
            jq("#jformOCBA_TOWN_CODE").val(id);
            zb.close();
        });
});
    
    
    
    //calendar ODATE
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSS1",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSS1",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSS2",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSS2",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSS3",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSS3",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSS4",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSS4",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSS5",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSS5",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSS6",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSS6",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSE1",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSE1",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSE2",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSE2",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSE3",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSE3",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSE4",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSE4",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSE5",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSE5",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
        window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BUSE6",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BUSE6",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_BDATE",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_BDATE",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });

    //Hung check user level 4
    <?php if($group != 11) { ?>
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_RDATE",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_RDATE",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_MDATE",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_MDATE",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_LDATE",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_LDATE",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_EDATE",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_EDATE",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    window.addEvent('domready', function() {Calendar.setup({
        	// Id of the input field
        	inputField: "jformCOCH_DDATE",
        	// Format of the input field
        	ifFormat: "%Y/%m/%d",
        	// Trigger for the calendar (button ID)
        	button: "jformCOCH_DDATE",
        	// Alignment (defaults to "Bl")
        	align: "Bl",
        	singleClick: true,
        	firstDay: 0
    	});
    
    });
    <?php } ?>
</script>